package dataapi

import (
	"iot-base/common/cache"
	"iot-base/common/webapi"
	"math/rand"
	"time"

	"github.com/gin-gonic/gin"
)

func init() {
	rand.Seed(time.Now().Unix())
}

func initVideoAddr(api *gin.RouterGroup) {
	vaddrAPI := api.Group("stream")
	{
		vaddrAPI.GET("/:tid", func(c *gin.Context) {
			tid := c.Param("tid")
			result, err := cache.GetVideoAddr(tid)
			webapi.SendResult(result, err, c)
		})
	}
}
